package com.zjp.service.impl;

import com.zjp.mapper.NucleicAndDectionMapper;
import com.zjp.mapper.NucleicTestMapper;
import com.zjp.pojo.NucleicTest;
import com.zjp.service.NucleicTestService;
import com.zjp.vo.NucleicAndDection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class NucleicTestServiceImpl implements NucleicTestService {
    @Autowired
    private NucleicTestMapper nucleicTestMapper;

    @Autowired
    private NucleicAndDectionMapper nucleicAndDectionMapper;

    /**
     * 添加核酸检测记录
     * @param nucleicTest
     * @return
     */
    public int nucleicTest(NucleicTest nucleicTest) {
        return nucleicTestMapper.insert(nucleicTest);
    }

    /**
     * 我的检测记录
     */
    public List<NucleicAndDection> selectMyNucleicResult(long id) {
        return nucleicAndDectionMapper.selectMyNucleicResult(id);
    }

    /**
     * 核酸全部检测结果
     */
    public List<NucleicAndDection> selectAllNucleicResult() {
        return nucleicAndDectionMapper.selectAllNucleicResult();
    }

    /**
     * 查询全部用户核酸结果
     */
    public List<NucleicTest> selectNucleicTestResult(String name, Date time, Integer result, Integer detectionid) {
        return nucleicTestMapper.selectNucleicTestResult(name,time,result,detectionid);
    }

    /**
     * 录入核酸检测结果
     * @param nucleicTest
     * @return
     */
    public int entryResult(NucleicTest nucleicTest) {
        return  nucleicTestMapper.updateByPrimaryKeySelective(nucleicTest);
    }
}
